<include file="Inc/html_header" />
<div class="searchBox mySelect">
	<form action="<?php echo U('admin/admin_list');?>" method="get">
		分组：<?php echo $groups;?>&nbsp;&nbsp;&nbsp;&nbsp;
		状态：<select name="st"><option value="">全部</option><option value="1" <?php if($param['st']=='1'){echo 'selected';}?>>正常</option><option value="0" <?php if($param['st']=='0'){echo 'selected';}?>>禁用</option></select>&nbsp;&nbsp;&nbsp;
		用户名：<input class="form-control form-focus input_text" type="text" name="admin_name_like" size="20" value="<?php echo $param['admin_name_like'];?>" />
		&nbsp;&nbsp;&nbsp;<input type="submit" name="so" class="btn btn-success" value="搜索" />
        <a class="btn btn-primary" style="float: right;" href="<?php echo U('admin/admin_add'); ?>">添加用户</a>
	</form>

</div>
<div class="mtop10">
	<table class="table table-bordered table-hover">
        <thead>
            <tr>
                <th width="40">ID</th>
                <th>用户名</th>
                <th width="100">分组</th>
                <th width="60">状态</th>
                <th width="60">操作</th>
            </tr>
        </thead>
        <tbody>
            <?php
            if( ! empty($list)){
                foreach($list as $v){
                    $v['admin_id'] = intval($v['admin_id']);
                    $v['st'] = intval($v['st']);
            ?>
            <tr>
                <td class="tdf"><?php echo $v['admin_id'];?></td>
                <td><?php echo $v['admin_name'];?></td>
                <td><?php echo $v['group_name'];?></td>
                <td><span class="c_p" onclick="adminStatus(<?php echo $v['admin_id'];?>, <?php echo (1-$v['st']);?>)"><?php if($v['st']===1){echo '<span class="color_1">正常</span>';}else{echo '<span class="color_0">禁用</span>';}?></span></td>
                <td>
                    <!--<a href="<?php echo U('admin/admin_del', array('admin_id'=>$v['admin_id']));?>" onclick="javascript:return confirm('提示：您确定要删除吗？')">删除</a> / -->
                    <a href="<?php echo U('admin/admin_edit', array('admin_id'=>$v['admin_id']));?>">修改</a>
                </td>
            </tr>
            <?php }}else{?>
            <tr>
                <td colspan="5">没有数据</td>
            </tr>
            <?php }?>
        </tbody>
	</table>
    <div style="height:10px;">&nbsp;</div>
	<?php echo $pager;?>
</div>
<script type="text/javascript">
    function adminStatus(admin_id, st)
    {
        $.ajax({
            url:'<?php echo U('admin/ajax_admin_st');?>',
            data:({'admin_id':admin_id, 'st':st}),
            type:'post',
            dataType:'json',
            success:function(msg){
                if(msg.st == 'y'){
                    alert('操作成功');
                    rl();
                }else{
                    alert(msg);
                }
            },
            error:function(){
                alert('网络繁忙，请稍后重试');
            }
        })
    }
</script>
<include file="Inc/html_footer" />